<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<button onclick="callName()">点名</button>
<script>
      /* // console.log(Math.random()*45);
       let arr = ['a','c','e','f','ed','dgfg'];
       let array = new Array('a','f','ed','dgfg');
        //arr[0];//0 ~ arr.length-1
        let RanIndex = Math.floor(Math.random()*(arr.length));
        console.log(arr[RanIndex]);
    */
        //随机点名，点过的名字不重复点，如果全部点完名推出点名并提示用户
    const names = ["张三", "李四", "王五", "杨六", "孙七"]; // 这里替换成你实际的名字列表
    let calledNames = [];

    function callName() {
      if (calledNames.length === names.length) {
        alert("所有人都已经点过名啦！");
        return;
      }

      let randomIndex;
      do {
        randomIndex = Math.floor(Math.random() * names.length);
      } while (calledNames.includes(names[randomIndex]));

      calledNames.push(names[randomIndex]);
      alert(names[randomIndex]);
    }

    /*
        //猜数字，猜中交作业
        let num;
        function cai(min,max){
            return Math.floor(Math.random()*(max-min)+1);
        }
        let boom = cai(1,10);
        while(true){
            num = prompt('输入你猜的数字');
            if(num == boom){
                alert('恭喜喜提作业!');
                break;
            }else if(num > boom){
                alert('你猜大了');
            }else{
                alert('你猜小了');
            }
        }
    */
    </script>
</html>